package com.zyz.M_File和IO流.IO流.对象流;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

/**
 * @author: vick
 * @Date: 2025/4/10
 * @Description:
 * @version: 1.0
 */
public class Demo2 {
    public static void main(String[] args) throws IOException {


        File file = new File("my.txt");
        FileInputStream fileInputStream = new FileInputStream(file);
        ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);

        String name = objectInputStream.readUTF();
        int age = objectInputStream.readInt();
        char sex = objectInputStream.readChar();
        double price = objectInputStream.readDouble();
        boolean flag = objectInputStream.readBoolean();
        System.out.println(name);
        System.out.println(age);
        System.out.println(sex);
        System.out.println(price);
        System.out.println(flag);
    }
}
